"""
Web 页面的主页
"""
from pom.basepage import BasePage
from pom.webpage.loginpage import LoginPage
from pom.webpage.settingpage import SettingPage

from env import data


class MainPage(BasePage):

    def go_to_mainpage(self):

        self.driver.get(data["env"]['testdev']['webpage'])

        return self

    def go_to_login_page(self):
        """
        打开登录页面
        :return:
        """
        self.driver.find_element_by_xpath('//a[@href="/signin"]').click()
        return LoginPage(self.driver)

    def go_to_setting_page(self):
        """
        到达设置页面
        :return:
        """
        self.driver.find_element_by_xpath('//a[@href="/setting"]').click()
        return SettingPage(self.driver)